package com.zxy.ziems.server.device.pojo.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zxy.ziems.server.utils.tree.TreeInterface;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * @author 10348359
 * @create 2024-03-20 10:53
 */
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder(toBuilder = true)
public class DataUnitTreeVO extends DataUnitVO implements TreeInterface<DataUnitTreeVO> {
    /**
     * 分组编码
     */
    @JsonIgnore
    private String groupCode;

    /**
     * 父级分组编码
     */
    @JsonIgnore
    private String parentGroupCode;

    /**
     * 是不是分组 true是分组 false不是分组
     */
    private Boolean isGroup;

    /**
     * 子节点
     */
    private List<DataUnitTreeVO> children;


    @Override
    public String _getTreeCode() {
        return groupCode;
    }

    @Override
    public String _getTreeParentCode() {
        return parentGroupCode;
    }

    @Override
    public void _setTreeChildren(List<DataUnitTreeVO> list) {
        setChildren(list);
    }

    @Override
    public List<DataUnitTreeVO> _getTreeChildren() {
        return children;
    }
}
